<?php
/**
 * add_js
 *
 * @package Movoin Blog
 * @subpackage Admin
 *
 */
function _ctlAdd_Js()
{
    $add_js = FLEA::getAppInf('add_js');
    $str = '<script type="text/javascript" src="loadjs.php?libs=jquery&admin=public,common';
    if ($add_js) { $str.='&'.joinToUri($add_js); }
    $str .= '"></script>';
    if ($add_js['editor']) { $str.=_editorJs(); }
    return $str;
}

function _editorJs()
{
    $view = FLEA::getSingleton(FLEA::getAppInf('view'));
    return $view->fetch('editor.js.html');
}

function joinToUri($str){
    $tmp = array();
    if (is_array($str)) {
        foreach($str as $k=>$s){
            $tmp[]=$k.'='.$s;
        }
    }
    return implode('&', $tmp);
}